﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CatchList.aspx.cs" Inherits="Manage_Cms_CatchList" %>
<html>
<head>
    <!--#include file="../js/html_head.inc"-->
    <link rel="stylesheet" type="text/css" href="../Themes/<%=ManageHelper.GetTheme()%>/style.css" />
    <script language="javascript" type="text/javascript">
        function onselect(val)
        {
            self.location.href=val+"/manage/cms/catchlist.aspx";
        }
        function onselect_site(val)
        {
            self.location.href="/manage/cms/catchlist.aspx?siteid="+val;
        }
    </script>
</head>
<body>
    <%=ManageHelper.PageSucMsg()!=""?"<div class='msg_succeed'>"+ManageHelper.PageSucMsg()+"</div>":""%>
    <%=ManageHelper.PageErrMsg()!=""?"<div class='msg_failed'>"+ManageHelper.PageErrMsg()+"</div>":""%>
    <table width="95%" align="center">
        <tr>
            <td align="right">
                <table cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td> 
                            <select onchange="onselect(this.value)" style="margin:0px;padding:0px">
                                <%
                                    if (bllCmsServer.GetSelect().Tables[0].Rows.Count > 0)
                                    {

                                        
                                    %>
                                     <%=KeRui.BLL.Common.GetSelectList(modelServer.ServerUrl, bllCmsServer.GetSelect())%>
                                    <%
                                    
                                }
                                    %>
                            </select>
                            
                            <select onchange="onselect_site(this.value)" style="margin:0px;padding:0px">
                                <%
                                    if (modelServer != null)
                                    {
                                        if (bllSite.GetSiteSel(modelServer.ServerID).Tables[0].Rows.Count > 0)
                                        {
                                    %>
                                     <%=KeRui.BLL.Common.GetSelectList(SiteID, bllSite.GetSiteSel(modelServer.ServerID))%>
                                    <%
                                    }
                                }
                                      %>
                            </select>
                            
                            <input style="margin:0px;padding:0px" type="submit" name="AddGroup" value="添加采集规则" onclick="ymPrompt.win('CatchItem.aspx',490,490,'添加采集规则',null,null,null,true);"
                                id="AddGroup" class="button" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <div class="column">
        <div class="columntitle">
            采集规则管理</div>
        <table cellspacing="0" cellpadding="0" rules="all" align="center" border="0" id="MyDataGrid" style="border-width: 0px; width: 100%; border-collapse: collapse;">
            <tr class="summary-title" style="height: 25px;">
                <td align="center" style="width: 40px;">编号</td>
                <td>采集名称</td>
                <td>采集页码</td>
                <td>录入栏目</td>
                <td align="center">图片</td>
                <td align="center">类型</td>
                <td align="center">频率</td>
                <td align="center">采集状态</td>
                <td align="center">状态</td>
                <td align="center">操作</td>
            </tr>
            <%foreach (KeRui.Model.CmsCatch model in listCmsCatch)
              {%>
            <tr class="tdbg" onmouseover="this.className='tdbg-dark';" onmouseout="this.className='tdbg';"   style="height: 25px;">
                <td  align="center" style="width: 40px;"><%=model.CatchID %></td>
                <td><%=model.CatchName%></td>
                <td>
                <%if (model.ParseID > 0){%>
                第<%=model.StartPage == model.EndPage ? model.StartPage.ToString() : model.StartPage.ToString() + "-" + model.EndPage.ToString()%>页</td>
                <%}else{%><%}%>
                <td>
                <%if (model.ParseID > 0){%>
                <%=model.NodeName%><span style='color:red'><%=model.NodeID%></span>
                <%}else{%>【系统进程】<%}%>
                </td>
                <td align="center">
                <%if (model.ParseID > 0){%>
                <%=model.SavePic == 1 ? "<span style='color:red'>√</span>" : "<span style='color:blue'>×</span>"%>
                <%}else{%><%}%>
                </td>
                <td align="center">
                <%if (model.ParseID > 0){%>
                <%
                  if (model.ContentType == 0) {
                        Response.Write("普通");
                  }else if (model.ContentType == 1) {
                        Response.Write("图片");
                    }
                    else if (model.ContentType == 2)
                    {
                        Response.Write("视频");
                    }
                    else if (model.ContentType == 3)
                    {
                        Response.Write("外链");
                    }
                  %>
                <%}else{%>
                
                <%
                  if (model.ContentType == 0) {
                        Response.Write("文章");
                  }else if (model.ContentType == 1) {
                        Response.Write("栏目");
                    }
                    else if (model.ContentType == 2)
                    {
                        Response.Write("广告");
                    }
                    else 
                    {
                        Response.Write("");
                    }
                  %>
                <%}%>
                </td>
                <td align="center" title="<%=model.Interval == 0 ? "立即" : "每" + model.Interval + "分钟"%>"><%=model.Interval == 0 ? "立即" : "" + model.Interval + "分"%></td>
                <td align="center"><%=model.State == 1 ? "<span style='color:blue'>正在采第 " + model.CurPage.ToString() + " 页</span>" : "未启动"%></td>
                <td align="center"><%=model.IsUsing == 1 ? "<span style='color:blue'>开启</span>" : "<span style='color:red'>关闭</span>"%></td>
                <td align="center">
                    <a href="javascript:ymPrompt.win('Catchitem.aspx?id=<%=model.CatchID %>&act=edit',590,490,'修改采集规则',null,null,null,true);"> 修改</a> | 
                     <%if (model.ParseID > 0){%>
                     <a href='Catchitem.aspx?id=<%=model.CatchID %>&act=del'onclick="javascript:return confirm('此操作将会删除采集规则“<%=model.CatchName %>”，确认吗？');">删除</a>
                     <%}else{%><disabled><s>删除</s></disabled><%}%> |
                     <%if(model.ParseID>0){%>
                     <a href="CatchParseTest.aspx?CatchID=<%=model.CatchID %>" target="_blank">测试</a>
                     <%}else{%><disabled><s>测试</s></disabled><%}%> |
                     <%if(model.ParseID>0){%>
                     <a href="CatchParseItem.aspx?id=<%=model.ParseID%>&act=edit&_catchname=<%=KeRui.Common.Utils.UrlEncode(model.CatchName,"utf-8")%>&_catchurl=<%=model.Url%>" target="_blank" title="<%=model.ParseName%>">调试</a>
                     <%}else{%><disabled><s>调试</s></disabled><%}%> 
                </td>
            </tr>
            <%}%>
        </table>
    </div>
    
</body>
</html>
